<?php
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:OPTIONS, GET, POST'); // 允许option，get，post请求
header('Access-Control-Allow-Headers:x-requested-with,content-type'); // 允许x-requested-with请求头
//var_dump($_REQUEST);die();
//$_REQUEST = json_decode($_REQUEST[0],true);
$kefu_name = empty($_REQUEST["kefu_name"]) ? '' : $_REQUEST["kefu_name"]; 

//var_dump($_GET);
//var_dump($_POST);
if(!empty($kefu_name)){
	$project_uniqueid = $_REQUEST["project_uniqueid"]; 
	$password = md5($_REQUEST["password"]); 
	try {
		$dbh = new PDO('mysql:host=127.0.0.1;dbname=hzceshi', "root", "sanyi*%#853");
		//$dbh = null;
	} catch (PDOException $e) {
		print "Error!: " . $e->getMessage() . "<br/>";
		die();
	}

	$sql = "select count(*) as count from ad_kefulist where kefu_name='".$kefu_name ."' and pj_uniqid='".$project_uniqueid."'";

	$cx = $dbh->query($sql);
	$data = $cx -> fetch();

	if($data["count"] > "0"){
		$sql = "select *  from ad_kefulist where kefu_name='".$kefu_name ."' and pj_uniqid='".$project_uniqueid."'";

		$cx = $dbh->query($sql);
		$data = $cx -> fetch();
		if($password == $data["password"]){
			//echo "1111";
			$result["Code"] = "200";
			$result["Msg"] = "登录成功!";
			echo  json_encode($result);
		}else{
			 $result["Code"] = "300";
			  $result["Msg"] = "账号密码错误!";
			  echo  json_encode($result);
		}
	}else{
		 
		  $result["Code"] = "300";
		  $result["Msg"] = "账号密码错误!";
		  echo  json_encode($result);
	}
	$dbh = null;
}



?>